package com.qzy.demo.mapper;

import com.qzy.demo.pojo.GradePojo;
import com.qzy.demo.pojo.StudentPojo;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface GradeMapper {
    @Insert("INSERT INTO grand(gname) "
            + "VALUES(#{gname})")
    void addGrade(GradePojo gradePojo);

    @Delete("DELETE FROM grand WHERE gid=#{id}")
    void delGrade(Integer id);

    @Update("UPDATE grand SET gname=#{gname} WHERE gid=#{gid}")
    void updGrade(GradePojo gradePojo);

    @Select("SELECT * FROM grand")
    @Results({
            @Result(property = "gid",  column = "gid"),
            @Result(property = "gname",  column = "gname"),
    })
    List<GradePojo> queryGrades();

    @Select("SELECT * FROM grand WHERE gid=#{gid}")
    @Results({
            @Result(property = "id",  column = "id"),
            @Result(property = "gname",  column = "gname"),
    })
    GradePojo queryGrade(Integer id);
}
